<?php
session_start();
class LoginController {

   function index(){
       $this->check_login();
   }

    function login(){
         include_once './modules/user_model.php'; 
         $user = user_model();
     
         if ($user->get_session()){
            header("location:indexController.php");
        }

        if ($_SERVER["REQUEST_METHOD"] == "POST"){
            
            $login = $user->check_login($_POST['username'], $_POST['password']);
            
            if ($login)
        {
            // Login Success
            header("location:LoginController.php");
        }
        else
        {
            // Login Failed
            $msg = 'Username / password wrong';
        }
        }

    }

}
